#include <header.h>

int main(){

    char *port = "8080";
    char *ip = "192.168.106.130";

    int socket_fd = socket(AF_INET, SOCK_STREAM, 0);


    struct sockaddr_in sock;
    sock.sin_family = AF_INET;
    sock.sin_port = htons(atoi(port));
    sock.sin_addr.s_addr = inet_addr(ip);
    connect(socket_fd, (struct sockaddr *)&sock, sizeof(sock));

    // 连接建立

    while(1){

        char buf[100] = {0};
        read(STDIN_FILENO, buf, sizeof(buf));
        send(socket_fd, buf, sizeof(buf), 0);


        bzero(buf, sizeof(buf));
        recv(socket_fd, buf, sizeof(buf), 0);
        printf("buf: %s \n", buf);

    }

    close(socket_fd);
    return 0;
}

